package com.gxjtkyy.datadistributer.writer.rdbms.config;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

@Configuration
@ConfigurationProperties(
   prefix = "db-writer"
)
public class WriterConfig {
   private long backOffInterval = 30000L;
   private Map<String, Integer> listenTopics = new HashMap();
   private List<TableSetting> tableSettings = new ArrayList();
   private boolean tableCaseSensitive = false;
   private boolean columnCaseSensitive = false;
   private boolean updatable = true;
   private String targetDbType = "oracle";

   public long getBackOffInterval() {
      return this.backOffInterval;
   }

   public Map<String, Integer> getListenTopics() {
      return this.listenTopics;
   }

   public List<TableSetting> getTableSettings() {
      return this.tableSettings;
   }

   public boolean isTableCaseSensitive() {
      return this.tableCaseSensitive;
   }

   public boolean isColumnCaseSensitive() {
      return this.columnCaseSensitive;
   }

   public boolean isUpdatable() {
      return this.updatable;
   }

   public String getTargetDbType() {
      return this.targetDbType;
   }

   public void setBackOffInterval(final long backOffInterval) {
      this.backOffInterval = backOffInterval;
   }

   public void setListenTopics(final Map<String, Integer> listenTopics) {
      this.listenTopics = listenTopics;
   }

   public void setTableSettings(final List<TableSetting> tableSettings) {
      this.tableSettings = tableSettings;
   }

   public void setTableCaseSensitive(final boolean tableCaseSensitive) {
      this.tableCaseSensitive = tableCaseSensitive;
   }

   public void setColumnCaseSensitive(final boolean columnCaseSensitive) {
      this.columnCaseSensitive = columnCaseSensitive;
   }

   public void setUpdatable(final boolean updatable) {
      this.updatable = updatable;
   }

   public void setTargetDbType(final String targetDbType) {
      this.targetDbType = targetDbType;
   }

   public boolean equals(final Object o) {
      if (o == this) {
         return true;
      } else if (!(o instanceof WriterConfig)) {
         return false;
      } else {
         WriterConfig other = (WriterConfig)o;
         if (!other.canEqual(this)) {
            return false;
         } else if (this.getBackOffInterval() != other.getBackOffInterval()) {
            return false;
         } else if (this.isTableCaseSensitive() != other.isTableCaseSensitive()) {
            return false;
         } else if (this.isColumnCaseSensitive() != other.isColumnCaseSensitive()) {
            return false;
         } else if (this.isUpdatable() != other.isUpdatable()) {
            return false;
         } else {
            Object this$listenTopics = this.getListenTopics();
            Object other$listenTopics = other.getListenTopics();
            if (this$listenTopics == null) {
               if (other$listenTopics != null) {
                  return false;
               }
            } else if (!this$listenTopics.equals(other$listenTopics)) {
               return false;
            }

            Object this$tableSettings = this.getTableSettings();
            Object other$tableSettings = other.getTableSettings();
            if (this$tableSettings == null) {
               if (other$tableSettings != null) {
                  return false;
               }
            } else if (!this$tableSettings.equals(other$tableSettings)) {
               return false;
            }

            Object this$targetDbType = this.getTargetDbType();
            Object other$targetDbType = other.getTargetDbType();
            if (this$targetDbType == null) {
               if (other$targetDbType != null) {
                  return false;
               }
            } else if (!this$targetDbType.equals(other$targetDbType)) {
               return false;
            }

            return true;
         }
      }
   }

   protected boolean canEqual(final Object other) {
      return other instanceof WriterConfig;
   }

   public int hashCode() {
//      int PRIME = true;
      int result = 1;
      long $backOffInterval = this.getBackOffInterval();
      result = result * 59 + (int)($backOffInterval >>> 32 ^ $backOffInterval);
      result = result * 59 + (this.isTableCaseSensitive() ? 79 : 97);
      result = result * 59 + (this.isColumnCaseSensitive() ? 79 : 97);
      result = result * 59 + (this.isUpdatable() ? 79 : 97);
      Object $listenTopics = this.getListenTopics();
      result = result * 59 + ($listenTopics == null ? 43 : $listenTopics.hashCode());
      Object $tableSettings = this.getTableSettings();
      result = result * 59 + ($tableSettings == null ? 43 : $tableSettings.hashCode());
      Object $targetDbType = this.getTargetDbType();
      result = result * 59 + ($targetDbType == null ? 43 : $targetDbType.hashCode());
      return result;
   }

   public String toString() {
      long var10000 = this.getBackOffInterval();
      return "WriterConfig(backOffInterval=" + var10000 + ", listenTopics=" + this.getListenTopics() + ", tableSettings=" + this.getTableSettings() + ", tableCaseSensitive=" + this.isTableCaseSensitive() + ", columnCaseSensitive=" + this.isColumnCaseSensitive() + ", updatable=" + this.isUpdatable() + ", targetDbType=" + this.getTargetDbType() + ")";
   }
}
